//
//  ViewController.m
//  iOSHeartAnimation
//
//  Created by ddy on 2018/7/26.
//  Copyright © 2018年 ddy. All rights reserved.
//

#import "ViewController.h"
#import "CAKeyFrameAnimationViewController.h"
#import "CABaseAnimationViewController.h"
#import "CASpringAnimationViewController.h"
#import "UIViewAnimationViewController.h"
#import "CATransitionAnimationViewController.h"
#import "CAAnimationGroupViewController.h"
#import "BoLangViewController.h"
#import "OtherAnimationViewController.h"
#import "PopAnimationViewController.h"
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
/** 动画数组 */
@property (nonatomic, strong) NSArray  *animationArray;
/** tableView */
@property (nonatomic, strong) UITableView  *tableView;

@end
static NSString * const kcellID = @"AnimationUITableViewCell";
@implementation ViewController
/** 动画数组 */
- (NSArray *)animationArray{
    if(!_animationArray){
        _animationArray = [NSArray arrayWithObjects:@"关键帧CAKeyFrameAnimation",@"CABaseAnimation",@"CASpringAnimation",@"UIViewAnimations",@"CATransition",@"CAAnimationGroup",@"BoLangViewController",@"OtherAnimationViewController",@"popAnimation", nil];
    }
    return  _animationArray;
}
/** tableView */
- (UITableView *)tableView{
    if(!_tableView){
        _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
    }
    return  _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    //add tableView
    [self.view addSubview:self.tableView];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kcellID];
    
    
}
#pragma mark --- <UITableViewDelegate,UITableViewDataSource>
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.animationArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kcellID];
    cell.textLabel.text = self.animationArray[indexPath.row];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        CAKeyFrameAnimationViewController *keyVc = [CAKeyFrameAnimationViewController new];
        [self.navigationController pushViewController:keyVc animated:YES];
    } else if (indexPath.row == 1) {
        CABaseAnimationViewController *baseVC = [CABaseAnimationViewController new];
        [self.navigationController pushViewController:baseVC animated:YES];
    } else if (indexPath.row == 2) {
        CASpringAnimationViewController *springVC = [CASpringAnimationViewController new];
        [self.navigationController pushViewController:springVC animated:YES];
    } else if (indexPath.row == 3) {
        UIViewAnimationViewController *viewVC = [UIViewAnimationViewController new];
        [self.navigationController pushViewController:viewVC animated:YES];
    } else if (indexPath.row == 4) {
        CATransitionAnimationViewController *transitionVC = [CATransitionAnimationViewController new];
        [self.navigationController pushViewController:transitionVC animated:YES];
    } else if (indexPath.row == 5) {
        CAAnimationGroupViewController *groupVC = [CAAnimationGroupViewController new];
        [self.navigationController pushViewController:groupVC animated:YES];
    } else if (indexPath.row == 6) {
        BoLangViewController *bolangVC = [BoLangViewController new];
        [self.navigationController pushViewController:bolangVC animated:YES];
    } else if (indexPath.row == 7) {
        OtherAnimationViewController *otherVC = [OtherAnimationViewController new];
        [self.navigationController pushViewController:otherVC animated:YES];
    } else if (indexPath.row == 8) {
        PopAnimationViewController *popVC = [PopAnimationViewController new];
        [self.navigationController pushViewController:popVC animated:YES];
    }
    
}







@end
